package com.zhao.controller;

import com.zhao.pojo.Dept;
import com.zhao.service.DeptClientService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @ClassName DeptConsumerController
 * @author:赵培舒
 * @date:Created in 2021/4/18 16:13
 * @Email:stevezhao@nyist.edu.cn
 * @description：消费者
 * @modified By：
 * @version: 1.0
 */
@RestController
public class DeptConsumerController {
    // 消费者不应该有service

    @Autowired
    private DeptClientService service = null;

    @RequestMapping("/consumer/dept/add")
    public boolean add(Dept dept){
        return this.service.addDept(dept);
    }

    @RequestMapping("/consumer/dept/get/{id}")
    public Dept get(@PathVariable("id") Long id){
        return this.service.queryById(id);
    }


    @RequestMapping("/consumer/dept/list")
    public List<Dept> list(){
        return this.service.queryAll();
    }
}
